<?php 

/**
*Form Builder & Admin Generator

*@author marcio <opi14@op.pl>, <polishvodka7@gmail.com>
*@copyright Copyright (c) 2011, marcio
*@version 1.6.5
*/


class Volta_Views
{

	/**
	*Skladowa klasy ktora przechowywuje kod html formularza
	*@access protected
	*@var string $label
	*/
	protected $view;

	
	/**
	*Konstruktor ustawiam nam typ widoku i zwraca jego zawartosc
	*@access public 
	*@param string $view nazwa widoku
	*@param array $form tablice z zawartoscia formularza
	*/
	public function __construct($view, $form)
	{
		if(!empty($view))
		{
			if(file_exists('libraries/drivers/View/'.$view.'.php'))
				require_once('libraries/drivers/View/'.$view.'.php');
				
			$view .= '_View';
			$this -> view = new $view($form);
		}
	}
	
	
	/**
	*Metoda ustawia bledy
	*@access public 
	*@param array $err
	*/
	public function set_errors($err)
	{
		$this -> view -> set_errors($err);
	}
	
	
	/**
	*Metoda ustawia wiadomosc
	*@access public 
	*@param string $msg
	*/
	public function set_message($msg)
	{
		$this -> view -> set_message($msg);
	}
	
	
	/**
	*Metoda zwraca nam kod html formularza
	*@access public 
	*@return string
	*/
	public function __toString()
	{
		return $this -> view -> render();
	}

}
?>